package main

import (
	"laohuo/http/controller/admin"

	"github.com/gin-gonic/gin"
)

func (r engine) router() {
	r.GET("/", func(ctx *gin.Context) {
		ctx.String(200, "hello")
	})

	// admin
	g1 := r.Group("/admin")

	// supplier
	supplier := &admin.Supplier{}
	g1.GET("/supplier", supplier.List)
	g1.POST("/supplier", supplier.Add)
	g1.POST("/supplier/active", supplier.Active)
	g1.POST("/supplier/unactive", supplier.Unactive)

	// wares
	wares := &admin.Wares{}
	g1.GET("/wares", wares.List)
	g1.POST("/wares", wares.Add)
	g1.DELETE("/wares", wares.Del)

	// sku
	sku := &admin.Sku{}
	g1.GET("/sku", sku.List)
	g1.POST("/sku", sku.Add)

	// wharehouse
	wh := &admin.Warehouse{}
	g1.GET("/warehouse", wh.List)
	g1.POST("/warehouse/in", wh.Input)
	g1.POST("/warehouse/out", wh.Output)

	// warehouse_bill
	whb := &admin.WarehouseBill{}
	g1.GET("/warehousebill", whb.List)
}
